package avicit.bdp.dcs.alert.dto;

import avicit.bdp.common.base.BaseDTO;
import avicit.platform6.core.annotation.log.FieldRemark;
import avicit.platform6.core.annotation.log.Id;
import avicit.platform6.core.annotation.log.LogField;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import org.apache.commons.lang3.StringUtils;

import javax.persistence.Column;
import javax.persistence.Table;
import javax.persistence.Transient;

/**
 * @金航数码科技有限责任公司
 * @作者：developer
 * @邮箱：developer@avic-digital.com
 * @创建时间： 2020-06-29 11:55
 * @类说明：告警配置实体类
 * @修改记录：
 */
@ApiModel(value = "AlertDTO", description = "bdp_dcs_alert")
@Table(name = "bdp_dcs_alert")
public class AlertDTO extends BaseDTO {

    private static final long serialVersionUID = 1L;

    @Id
    @LogField
    @ApiModelProperty(value = "主键")
    @FieldRemark(column = "id", field = "id", name = "id")
    @javax.persistence.Id
    @Column(name = "id")
    private String id;

    @LogField
    @ApiModelProperty(value = "迁移id，同步id")
    @FieldRemark(column = "job_id", field = "jobId", name = "jobId")
    @Column(name = "job_id")
    private String jobId;

    @LogField
    @ApiModelProperty(value = "监控项，迁移状态：1，同步状态：2")
    @FieldRemark(column = "monitor_item", field = "monitorItem", name = "监控项")
    @Column(name = "monitor_item")
    private Integer monitorItem;

    @LogField
    @ApiModelProperty(value = "报警规则")
    @FieldRemark(column = "alert_rule", field = "alertRule", name = "报警规则")
    @Column(name = "alert_rule")
    private String alertRule;

    @ApiModelProperty(value = "报警规则名称")
    @Transient
    private String alertRuleName;

    @LogField
    @ApiModelProperty(value = "用户id，多个逗号分隔")
    @FieldRemark(column = "user_ids", field = "userIds", name = "用户id")
    @Column(name = "user_ids")
    private String userIds;

    @LogField
    @ApiModelProperty(value = "状态，禁用：0，启用：1")
    @FieldRemark(column = "alert_status", field = "alertStatus", name = "状态")
    @Column(name = "alert_status")
    private Integer alertStatus;

    @ApiModelProperty(value = "组织机构代码")
    @FieldRemark(column = "org_identity", field = "orgIdentity", name = "组织机构代码")
    @Column(name = "org_identity")
    private String orgIdentity;

    @ApiModelProperty(value = "密级")
    @FieldRemark(column = "secret_level", field = "secretLevel", name = "密级")
    @Column(name = "secret_level")
    private String secretLevel;

    @ApiModelProperty(value = "用户name，多个逗号分隔")
    @Transient
    private String userNames;

    public String getId() {
        return id;
    }

    public void setId(String id) {
        this.id = id;
    }

    public String getJobId() {
        return jobId;
    }

    public void setJobId(String jobId) {
        this.jobId = jobId;
    }

    public Integer getMonitorItem() {
        return monitorItem;
    }

    public void setMonitorItem(Integer monitorItem) {
        this.monitorItem = monitorItem;
    }

    public String getAlertRule() {
        return alertRule;
    }

    public void setAlertRule(String alertRule) {
        this.alertRule = alertRule;
    }

    public String getAlertRuleName() {
        return alertRuleName;
    }

    public void setAlertRuleName(String alertRuleName) {
        this.alertRuleName = alertRuleName;
    }

    public String getUserIds() {
        return userIds;
    }

    public void setUserIds(String userIds) {
        this.userIds = userIds;
    }

    public Integer getAlertStatus() {
        return alertStatus;
    }

    public void setAlertStatus(Integer alertStatus) {
        this.alertStatus = alertStatus;
    }

    public String getUserNames() {
        return userNames;
    }

    public void setUserNames(String userNames) {
        this.userNames = userNames;
    }

    @Override
    public String getLogFormName() {
        if (StringUtils.isEmpty(super.logFormName)) {
            return "告警管理";
        } else {
            return super.logFormName;
        }
    }

    @Override
    public String getLogTitle() {
        if (StringUtils.isEmpty(super.logTitle)) {
            return "告警";
        } else {
            return super.logTitle;
        }
    }

}